
angular.module('todoApp', [])
    .controller('TodoController', ['$scope', function($scope) {

        $scope.columns = [];

        var i = 1;
        for( i; i <= 20; i++ ){
            $scope.columns.push([
                {id: i+'.1',  stt: 1, color: 'black',bit: '000', show: true},
                {id: i+'.2',  stt: 2, color: 'black',bit: '000', show: false},
                {id: i+'.3',  stt: 3, color: 'black',bit: '000', show: false},
                {id: i+'.4',  stt: 4, color: 'black',bit: '000', show: false},
                {id: i+'.5',  stt: 5, color: 'black',bit: '000', show: false},
                {id: i+'.6',  stt: 6, color: 'black',bit: '000', show: false},
                {id: i+'.7',  stt: 7, color: 'black',bit: '000', show: false},
                {id: i+'.8',  stt: 8, color: 'black',bit: '000', show: false},
                {id: i+'.9',  stt: 9, color: 'black',bit: '000', show: false},
                {id: i+'.10', stt: 10,color: 'black',bit: '000', show: false},
                {id: i+'.11', stt: 11,color: 'black',bit: '000', show: false},
                {id: i+'.12', stt: 12,color: 'black',bit: '000', show: false},
                {id: i+'.13', stt: 13,color: 'black',bit: '000', show: false},
                {id: i+'.14', stt: 14,color: 'black',bit: '000', show: false},
                {id: i+'.15', stt: 15,color: 'black',bit: '000', show: false},
                {id: i+'.16', stt: 16,color: 'black',bit: '000', show: false},
                {id: i+'.17', stt: 17,color: 'black',bit: '000', show: false},
                {id: i+'.18', stt: 18,color: 'black',bit: '000', show: false},
                {id: i+'.19', stt: 19,color: 'black',bit: '000', show: false},
                {id: i+'.20', stt: 20,color: 'black',bit: '000', show: false},
                {id: i+'.21', stt: 21,color: 'black',bit: '000', show: false},
                {id: i+'.22', stt: 22,color: 'black',bit: '000', show: false},
                {id: i+'.23', stt: 23,color: 'black',bit: '000', show: false},
                {id: i+'.24', stt: 24,color: 'black',bit: '000', show: false},
                {id: i+'.25', stt: 25,color: 'black',bit: '000', show: false},
                {id: i+'.26', stt: 26,color: 'black',bit: '000', show: false},
                {id: i+'.27', stt: 27,color: 'black',bit: '000', show: false},
                {id: i+'.28', stt: 28,color: 'black',bit: '000', show: false},
                {id: i+'.29', stt: 29,color: 'black',bit: '000', show: false},
                {id: i+'.30', stt: 30,color: 'black',bit: '000', show: false},
                {id: i+'.31', stt: 31,color: 'black',bit: '000', show: false},
                {id: i+'.32', stt: 32,color: 'black',bit: '000', show: false},
                {id: i+'.33', stt: 33,color: 'black',bit: '000', show: false},
                {id: i+'.34', stt: 34,color: 'black',bit: '000', show: false},
                {id: i+'.35', stt: 35,color: 'black',bit: '000', show: false},
                {id: i+'.36', stt: 36,color: 'black',bit: '000', show: false},
                {id: i+'.37', stt: 37,color: 'black',bit: '000', show: false},
                {id: i+'.38', stt: 38,color: 'black',bit: '000', show: false},
                {id: i+'.39', stt: 39,color: 'black',bit: '000', show: false},
                {id: i+'.40', stt: 40,color: 'black',bit: '000', show: false}
            ]);
        }

        $scope.chooseLed = function(led){
            console.log(led);
        };


        $scope.todos = [
            {text:'learn angular', done:true},
            {text:'build an angular app', done:false}];

        $scope.addTodo = function() {
            $scope.todos.push({text:$scope.todoText, done:false});
            $scope.todoText = '';
        };

        $scope.remaining = function() {
            var count = 0;
            angular.forEach($scope.todos, function(todo) {
                count += todo.done ? 0 : 1;
            });
            return count;
        };

        $scope.archive = function() {
            var oldTodos = $scope.todos;
            $scope.todos = [];
            angular.forEach(oldTodos, function(todo) {
                if (!todo.done) $scope.todos.push(todo);
            });
        };
    }]);

